const app = getApp()
const $api = require('../../../../utils/api.js').API;
Page({
    data: {
        jobCate:[],
    },
    onLoad: function(e){
      this.getJobCate(e.post)
    },
    getJobCate:function(post){
      var data = {}
      var that = this
      $api.get('job/list',data).then(res =>{
          //请求成功
          if(res.data.code == 1){
            that.cateData(res.data.data,post)
          }
      })
    },
    checkboxChange(e) {
      var post = e.detail.value;
      post = post.join(',');
      wx.setStorageSync('post',post);
    },
    cateData:function(cate,post){
      var that = this
      let post1 = post.split(',')
      for(var x in cate){
        if(post1.indexOf(cate[x]['name']) >= 0){
          cate[x]['checked'] = true
        }
      }
      that.setData({
        jobCate:cate
      })
    },
    onShareAppMessage: function() {
      return {
          title: "天意美业直通车",
          path: "/pages/index/index?puid="+wx.getStorageSync('uid')
      };
    }
});